package EX02_Answer;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

public class EX02_AccountDAO implements EX02_IAccountDAO{
	
	private String DRV = "oracle.jdbc.driver.OracleDriver";
	private String URL = "jdbc:oracle:thin:realdance/realdance@112.216.253.125:1521:xe";
	private String insertSQL = "insert into Account values (?,?,?,sysdate)"; 
	private String selectSQL = ""; 
	private String updateSQL = ""; 
	private String deleteSQL = ""; 
			
		
	@Override
	public boolean insertAccount(EX02_AccountVO avo) {

		Connection conn = null;
		PreparedStatement pstmt = null;
		boolean result = false;
		
		try{conn = openDatabase();
			pstmt = conn.prepareStatement(insertSQL);
			pstmt.setString(1, avo.getAid());
			pstmt.setString(2, avo.getBalance());
			pstmt.setString(3, avo.getInterestRate());
			pstmt.execute();
			result = true;
		}catch(Exception ex){
			ex.printStackTrace();
		}finally{
			closeDatabase(conn, pstmt, null);
		}
		return result;
	}

	private Connection openDatabase(){
		return null;
	}
	
	private void closeDatabase(
			Connection c, PreparedStatement p, ResultSet r){
		
	}
	
	
}
